package com.coolwen.spring.dao;/**
 * Created by CoolWen on 2017/11/16.
 */

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import javax.annotation.Resource;

/**
 * @author CoolWen
 * @version 2017-11-16 20:52
 */
public class BaseDao {
    private SessionFactory sessionFactory;

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    @Resource(name="sessionFactory")
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    protected Session getSession() {

        return sessionFactory.getCurrentSession();
    }
}
